package me.zhengjie.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.system.domain.VerificationCode;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author jie
 * @date 2018-12-26
 */
public interface VerificationCodeMapper extends BaseMapper<VerificationCode> {

    /**
     * 获取有效的验证码
     * @param scenes 业务场景，如重置密码，重置邮箱等等
     * @param type
     * @param value
     * @return
     */
    @Select("select * from verification_code where scenes=#{scenes} and type=#{type} and value=#{value} and status=1")
    VerificationCode findByScenesAndTypeAndValueAndStatusIsTrue(@Param("scenes") String scenes, @Param("type")String type, @Param("value")String value);
}
